<!DOCTYPE html>
<html>
<head>
  <meta charset="utf-8">
  <title>历史记录</title>
  <meta name="renderer" content="webkit">
  <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
  <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
  <link rel="stylesheet" type="text/css" href="assets/layui/css/layui.css" media="all"/>
  <link rel="stylesheet" type="text/css" href="assets/css/all.css"/>
</head>
<body class="car-history"> 
<span class="layui-breadcrumb">
    <a>旧件拍卖系统</a>
	<a><cite>历史记录</cite></a>
</span>
<div class="layui-fluid">
	<div class="layui-form">
		<div class="layui-form-item">
			<p class="layui-col-md6 " style="margin-right:10px;"><input id="key1" type="text" name="title"  placeholder="填写符合条件的搜索内容，例：车架号、车型信息" autocomplete="off" class="layui-input"> </p>
		</div>
		<div class="carTable">
			询价截止时间：
			<div class="layui-inline">
				<input type="text" name="date" id="date" placeholder="年-月-日 时:分:秒" autocomplete="off" class="layui-input layui-date">
			</div>
			<button class="layui-btn" data-type="reload">搜索</button>
		</div>
	</div>
	<table class="layui-hide" id="xcHistory" lay-filter="xc-history"></table>            
	<script type="text/html" id="checkInfor">
	  	<a class="layui-btn layui-btn-xs" lay-event="detail">查看</a>
	</script>  
</div>
<script src="assets/layui/layui.js" type="text/javascript"></script>
<script type="text/javascript" src="assets/js/all.js" ></script>
<script type="text/javascript">
	layui.use(['table','layer','laypage'],function(){
				var table = layui.table,
					layer = layui.layer,
					laypage = layui.laypage,
					$ = layui.$;
					
					//询残系统历史记录js
					var tableIn = table.render({
						elem: '#xcHistory',
						url: 'assets/data/oldhis.json',
						cols: [
							[{
								field: 'id',
								title: '车架号'
							}, {
								field: 'username',
								title: '车型信息'
							}, {
								field: 'sex',
								title: '分公司'
							}, {
								field: 'statu',
								title: '状态'
							}, {
								field: 'experience',
								title: '中标方'
							}, {
								field: 'experience',
								title: '中标价'
							}, {
								field: 'wealth',
								title: '询价开始时间',
								minWidth: 110
							}, {
								field: 'wealth',
								title: '询价结束时间',
								minWidth: 110
							}, {
								//fixed: 'right',
								align: 'center',
								toolbar: '#checkInfor'
							}]
						],
						page: true,
						limit: 10,
						limits:[10]
//						done:function(res,curr,count){//res即为你接口返回的信息,curr 是当前页，count总页数
//							if(res.code == 0){
//								layer.msg(res.msg);
//							}
//							if(res.code == 1){
//								
//							}
//						}
					});
				
					$('.carTable .layui-btn').on('click', function() {
						var key1 = $('#key1').val();	
						var key2 = $('#key2 option:selected').val();
						var key3 = $('#date').val();
						//执行重载
						tableIn.reload({
//							if(key1==''&key2==''&key3==''){
//								layer.msg("请输入搜索条件");
//								return;
//							}
							page: {
								curr: 1 //重新从第 1 页开始
							},
							where: {
								key1: key1,
								key2: key2,
								key3: key3
							}
						});
					});
				
					//监听工具条
					table.on('tool(xc-history)', function(obj) {
						var data = obj.data;
						if(obj.event === 'detail') {
							//  	layer.alert('编辑行：<br>'+ JSON.stringify(data))
							var index = layer.open({
								type: 2,
								title: '车辆信息',
								area: ['700px', '450px'],
								fixed: false, //不固定
								maxmin: true,
								content: 'carDetail.html'
							});
							layer.full(index);
				
						} else if(obj.event === 'del') {
							layer.confirm('真的删除此行信息么', function(index) {
								obj.del();
								layer.close(index);
							});
						}
						//  else if(obj.event === 'edit'){
						//    layer.msg('ID：'+ data.id + ' 的查看操作');
						//  }
					});
	})
</script>
</body>
</html>